﻿
@using Stamp_For_Africa_Version_2.Models
@model Stamp_For_Africa_Version_2.ViewModels.SearchFormViewModel
@{
    ViewBag.Title = "SearchResults";
}

<h2>Search Results</h2>



@if (Model.SearchedWithImage){
	
	<fieldset>
	<legend>Your image</legend>
	<img src='@Model.NonRootedImageSearchedFor' />
	</fieldset>
}
<fieldset>
<legend>Best match</legend>
@if (@Model.SearchResults.Count() > 0)
{
<img alt ="" src='@Url.Action("ShowStamp", "Stamps", new { @Model.SearchResults.First().Id })' width="100", height=auto/>


<fieldset>
	<legend>Details</legend>
	<table>

	<tr>
	 <td class="DetailsTable-Field">Match probability</td>
	 <td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().MatchProbability)</td>
	</tr>


	<tr>
	 <td class="DetailsTable-Field">Country</td>
	 <td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().Country.Name)</td>
	</tr>

	<tr>
		<td class="DetailsTable-Field ">Face Value</td>
		<td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().FaceValue)</td>	
	</tr>

	<tr>
		<td class="DetailsTable-Field ">Current Value (Mint - Never Hinged)</td>
		<td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().ValueMintNeverHinged)</td>	
	</tr>

	<tr>
		<td class="DetailsTable-Field ">Current Value (Mint - Hinged)</td>
		<td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().ValueMintHinged)</td>	
	</tr>

	<tr>
		<td class="DetailsTable-Field ">Current Value (Used)</td>
		<td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().ValueUsed)</td>	
	</tr>
		
	<tr>
		<td class="DetailsTable-Field ">Native currency</td>
		<td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().Currency.DisplayName)</td>	
	</tr>

	<tr>
		<td class="DetailsTable-Field ">Issued between</td>
		<td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().ShortFromDate) - @Html.DisplayFor(model => @Model.SearchResults.First().ShortToDate)</td>	
	</tr>

	<tr>
		<td class="DetailsTable-Field ">Artist</td>
		<td class="display-field">@Html.DisplayFor(model => @Model.SearchResults.First().Artist.DisplayName)</td>	
	</tr>


	</table>
</fieldset>

}
</fieldset>

<fieldset>
<legend>Other results</legend>
<table>
	@using (Html.BeginForm("Index", "Stamps", FormMethod.Post, new { id = "TheForm" }))
 {

		<tr>
			<th>
			</th>
			<th valign=top align=center>
				Name
			</th>
			<th valign=top align=center>
				Country
			</th>
			<th valign=top align=center>
				Face Value
			</th>
			<th valign=top align=center>
				Mint Never Hinged Value
			</th>
			<th valign=top align=center>
				Mint Hinged Value
			</th>
			<th valign=top align=center>
				Used Value
			</th>
			<th valign=top align=center>
				Currency
			</th>
			<th valign=top align=center>
				Issued between
			</th>
			<th valign=top align=center>
				Artist
			</th>
			<th valign=top align=center>
				Category
			</th>
			<th valign=top align=center>
				Sub-Category
      </th>
      <th valign=top align=center>
        Match Probability
      </th>
		</tr>
 }
	@foreach (var item in Model.SearchResults)
 {
		<tr>
			<td>
				<img alt ="" src='@Url.Action("ShowStamp", "Stamps", new { item.Id })' width="100", height=auto/>
			</td>
			<td>
				@Html.ActionLink(item.DisplayName, "Details", new { id = item.Id })
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Country.Name)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.FaceValue)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.ValueMintNeverHinged)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.ValueMintHinged)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.ValueUsed)
			</td>

			<td>
				@Html.DisplayFor(modelItem => item.Currency.DisplayName)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.ShortFromDate) - @Html.DisplayFor(modelItem => item.ShortToDate)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Artist.DisplayName)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.Category.DisplayName)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.SubCategory)
			</td>
			<td>
				@Html.DisplayFor(modelItem => item.MatchProbability)
			</td>


		</tr>
 }
</table>
</fieldset>
